<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>A Client-Server</title>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

</head>

<body>

<h1>Client-URL</h1>
<div id="clientId"></div>

<h2>Log</h2>
<div id="log"></div>

<h2>Test-Form</h2>
<form target="_blank" method="Get" id="testForm">
  Message: <input type="text" name="message" value="Hello World">
  <input type="submit" value="Submit (Will open a new window) and display message here">
</form>

<p><a href="chat.html">Demo Chat-Client</a></p>

<p><a href="http://joose-js.blogspot.com" target="_top">More Info</a></p>

<script type="text/javascript" src="http://universal-comet.appspot.com/static/client-server-mini.js"></script>
<script type="text/javascript">
var server = new Addressable.Server({ useGears: true });

server.onmessage = function (message) {
	log(message)
}

server.connect(function (id, url) {
    log("Connected. Messages will appear here.")
    $("#clientId").html("Client-Url: "+url)
    $("#testForm").attr("action", url)
})

function log(msg) {
    var log = $("#log");
	log.html(""+msg + "<br />" + log.html())
}

</script>

</body>
</html>
